package util

import "strings"

// StrIsEmpty 判断字符串是否为空
func StrIsEmpty(s string) bool {
	return strings.EqualFold(s, "")
}

// StrTrimAllSpace 去除字符串里所有空格
func StrTrimAllSpace(s string) string {
	return strings.Replace(s, " ", "", -1)
}

// StrTrim  去除字符串左右两边的空格
func StrTrim(s string) string {
	return strings.TrimSpace(s)
}

// ToCamelCase 转换为驼峰命名
func ToCamelCase(s string) string {
	result := ""
	if StrIsEmpty(s) {
		return result
	}
	parts := strings.FieldsFunc(s, func(r rune) bool {
		return r == '-' || r == '_' || r == ' '
	})
	for i, part := range parts {
		if i == 0 {
			result += strings.ToLower(part)
		} else {
			result += strings.Title(strings.ToLower(part))
		}
	}
	return result
}
